        var unSubmitStore = new Ext.data.JsonStore({
    		url: '/weihe/getList_unSubmit',
			root: 'datas',
			fields : [{
			        	   name:'UnSubmitId',mapping:'id'
			          },{
			        	   name:'UnSubmitCheckCode',mapping:'checkCode'
			          },{
			        	   name:'UnSubmitMoney',mapping:'money' 
			          },{
			        	   name:'UnSubmitCurrency',mapping:'currency' 
			          },{
			        	   name:'UnSubmitEsum',mapping:'esum' 
			          },{
        				   name:'UnSubmitCustomCode',mapping:'customCode'
        			  },{
        				   name:'UnSubmitDate',mapping:'date',type : 'date', dateFormat:"Y-m-d"
        			  },{
        				   name:'UnSubmitLastDate',mapping:'lastDate',type : 'date', dateFormat:"Y-m-d"
        			  },{
        				   name:'UnSubmitReceiDate',mapping:'receiDate',type : 'date', dateFormat:"Y-m-d"
        			  }],
						listeners :{ 
					   'beforeload':function(s,options) {
							var tag = 0;
							Ext.Ajax.request({
								url : '/weihe/getListJudge_unSubmit',
								success : function(response) {
									var json = Ext.decode(response.responseText);
									if (json.deny) {
										Ext.Msg.alert('错误',json.msg);
										tag = 1;
									}
										if(tag == 1){
											return false;
										}else{
											return true;						
										}
								},
								failure : function() {
									Ext.Msg.alert('错误', '失败!');
									tag =1;
								}
							});
			   }
			}
		});
        
        var EIStore = new Ext.data.JsonStore({
        	url: '/weihe/getEIList_invoiceTrack',
			root: 'datas',
			fields : [{
						name:'ExistentInvoiceId',mapping:'id'
					},{
     				   name:'ExistentInvoiceDate', mapping:'date',type : 'date', dateFormat:"Y-m-d"
      			  	},{
						name:'ExistentInvoiceInvoiceNum',mapping:'invoiceNum'
					},{
						name:'ExistentInvoiceCompany',mapping:'company'
					},{
						name:'ExistentInvoiceName',mapping:'name'
					},{
				    	name:'ExistentInvoiceCount',mapping:'count'
				    },{
				    	name:'ExistentInvoiceMoney',mapping:'money'
				    },{
				    	name:'ExistentInvoiceTax',mapping:'tax'
				    },{
				    	name:'ExistentInvoiceTaxRate',mapping:'taxRate'
				    },{
				    	name:'ExistentInvoiceFlag',mapping:'flag'
				    }],
						listeners :{ 
					   'beforeload':function(s,options) {
							var tag = 0;
							Ext.Ajax.request({
								url : '/weihe/getListJudge_unSubmit',
								success : function(response) {
									var json = Ext.decode(response.responseText);
									if (json.deny) {
										Ext.Msg.alert('错误',json.msg);
										tag = 1;
									}
										if(tag == 1){
											return false;
										}else{
											return true;						
										}
								},
								failure : function() {
									Ext.Msg.alert('错误', '失败!');
									tag =1;
								}
							});
			   }
			}
		});
        
        var taxItemStore = new Ext.data.JsonStore({
			url: '/weihe/getItems_unSubmit',
			root: 'datas',
			fields : [{
			        	   name:'TaxId',mapping:'id'
			          },{
			        	   name:'TaxName',mapping:'name' 
			          },{
        				   name:'TaxCode',mapping:'code'
        			  },{
        				   name:'TaxNoticeDate', mapping:'noticeDate',type : 'date', dateFormat:"Y-m-d"
        			  },{
        				   name:'TaxPromiseDate', mapping:'promiseDate',type : 'date', dateFormat:"Y-m-d"
        			  },{
        				   name:'TaxActualDate', mapping:'actualDate',type : 'date', dateFormat:"Y-m-d"
        			  },{
        				   name:'TaxMoney',mapping:'money'
        			  },{
        				   name:'TaxTaxRate',mapping:'taxRate'
        			  },{
        				   name:'TaxFlag',mapping:'flag'
        			  },{
        				   name:'TaxTax',mapping:'tax'
        			  },{
        				   name:'TaxReason',mapping:'reason'
        			  },{
        				   name:'TaxSubmitDate', mapping:'submitDate',type : 'date', dateFormat:"Y-m-d"
        			  }],
						listeners :{ 
					   'beforeload':function(s,options) {
							var tag = 0;
							Ext.Ajax.request({
								url : '/weihe/getListJudge_unSubmit',
								success : function(response) {
									var json = Ext.decode(response.responseText);
									if (json.deny) {
										Ext.Msg.alert('错误',json.msg);
										tag = 1;
									}
										if(tag == 1){
											return false;
										}else{
											return true;						
										}
								},
								failure : function() {
									Ext.Msg.alert('错误', '失败!');
									tag =1;
								}
							});
			   }
			}
		});
       
        
unSubmits = function(){
	
	var tmp='';

	
  return{
	  
	  
		listPanel : function(){
	  
		var listPanel = new Ext.Panel( {
			                    region : 'north',
			                    layout : 'border',
			                    frame  : true,
			                    height :250,
			                    items  : [unSubmits.listGrid(),unSubmits.listForm()] 
		                      });
	  
	  return listPanel;
},

listForm : function(){
    


		var button_add = new Ext.Button({
			text : '添加',
			handler : function() {
				progressConsole();
				if(listForm.form.isValid()){ 
					Ext.getCmp("unSubmitItemForm").buttons[0].enable();
					Ext.getCmp("unSubmitItemForm").buttons[1].enable();
					Ext.getCmp("unSubmitItemForm").buttons[2].enable();
					if (listForm.form.findField("UnSubmitId").getValue() == "") {
						 listForm.form.submit({
						     url : '/weihe/add_unSubmit',
						     success : function(form, action) {
							      if (action.result.deny) {
									 Ext.Msg.alert('错误', action.result.msg);
								  }else{
								        Ext.Msg.alert('消息', action.result.msg, function() {
								        Ext.getCmp("unSubmitForm").form.reset();
									    Ext.getCmp("unSubmitItemForm").form.findField('unSubmit.id').setValue(action.result.unSubmit_id);
									    Ext.getCmp("unSubmitGrid").getStore().load({params : {start : action.result.total-1, limit : 5}});
								        });
							       }
						     }
					      });
					}else {
							listForm.form.submit({
								url : '/weihe/update_unSubmit',
								success : function(form, action) {
									if (action.result.deny) {
									 Ext.Msg.alert('错误', action.result.msg);
								  }else{
										Ext.Msg.alert('消息', action.result.msg, function() {
											Ext.getCmp("unSubmitGrid").getStore().reload();
										});
									}
							   }
							});
					}
				}else{
					Ext.Msg.alert('提示','请输入相关内容');
				}
			}
		});

	var button_clear = new Ext.Button({
		text : '清空',
		handler : function() {
		
			listForm.form.reset();
			listForm.buttons[0].setText('添加');
			Ext.getCmp("unSubmitItemForm").form.reset();
			Ext.getCmp("unSubmitItemForm").buttons[0].disable();
		    Ext.getCmp("unSubmitItemForm").buttons[1].disable();
		    Ext.getCmp("unSubmitItemForm").buttons[2].disable();
		    Ext.getCmp("unSubmitItemGrid").getStore().removeAll();
		}
	});

	var button_del = new Ext.Button({
		text : '删除',
		handler : function() {
			var id = listForm.form.findField('UnSubmitId').getValue();
			if (id == '') {
				Ext.Msg.alert('提示', '请选择需要删除的信息!');
			} else {
				progressConsole();
				Ext.Ajax.request({
					url : '/weihe/delete_unSubmit',
					success : function(response) {
						var json = Ext.decode(response.responseText);
						if (json.success) {
							if (json.deny) {
											Ext.Msg.alert('消息', json.msg);
										}else{
							Ext.Msg.alert('消息', json.msg, function() {
								Ext.getCmp("unSubmitGrid").getStore().load({params : {start : 0, limit : 5}});
								listForm.form.reset();
								listForm.buttons[0].setText('添加');
							});
						  }
						}else{
							Ext.Msg.alert('消息', json.msg);
						}
					},
					failure : function() {
						Ext.Msg.alert('错误', '删除失败!');
					},
					params: { 'unSubmit.id' : listForm.form.findField('UnSubmitId').getValue() }
				});
			}
		}
	});
	  
	 var cComboData = new Ext.data.SimpleStore({
			fields : ['text'],
			data : [['人民币'],['美元'],['港币'],['其他']]
		});
	
			var listForm = new Ext.form.FormPanel({
			id : 'unSubmitForm',
			region : 'east',
			title : '退税信息',
			frame : true,
			width : 310,
			autoScroll : true,
			collapseMode :'mini',
			collapsible : true,
			labelAlign : 'right',
			labelWidth : 70,
			defaultType : 'textfield',
				defaults : {
				width : 200
			},
			items : [{
				id: 'UnSubmitId',
				xtype : 'hidden',
				name : 'unSubmit.id'
			},{
				id: 'UnSubmitCheckCode',
				fieldLabel: "核销单号",
				name: "unSubmit.checkCode"
			},{
				id:'UnSubmitCustomCode',
				fieldLabel : '报关单号',
 				name : 'unSubmit.customCode'
			},{
				id: 'UnSubmitDate',
                xtype: 'datefield',
                fieldLabel: "出口日期",
                format : 'Y-m-d',
    			allowBlank:false,
                name: "unSubmit.date"
			},{
				id: 'UnSubmitLastDate',
                xtype: 'datefield',
                fieldLabel: "申报日期",
                format : 'Y-m-d',
    			allowBlank:false,
                name: "unSubmit.lastDate"
			},{
				id: 'UnSubmitReceiDate',
                xtype: 'datefield',
                fieldLabel: "录入单日期",
                format : 'Y-m-d',
    			allowBlank:false,
                name: "unSubmit.receiDate"
			},{
				id:'UnSubmitCurrency',
				fieldLabel : '币种',
 				name : 'unSubmit.currency',
 				xtype : 'combo',
 				store : cComboData,
 				emptyText : '请选择',
 				mode : 'local',
 				triggerAction : 'all',
 				allowBlank:false,
 				editable: false,
 				value:'人民币',
 				displayField : 'text'
			},{
				id:'UnSubmitEsum',
				fieldLabel : '出口金额',
 				name : 'unSubmit.esum'
			}],
			buttons : [button_add,button_clear,button_del]
	});
	  
	  return listForm;
},  
	  
	  
  listGrid : function(){
  	
  		 var idArray = new Array();
	  
		var pageToolBar = new Ext.PagingToolbar({
			pageSize : 5,
			store : unSubmitStore,
			displayInfo : true,
			displayMsg : '当前显示{0}-{1}条记录,共{2}条记录',
		    emptyMsg : "没有记录显示!",
		    firstText : '首页',
		    prevText : '上一页',
		    nextText : '下一页',
		    lastText : '尾页',
		    beforePageText : '第',
		    afterPageText : '页,共{0}页'
		});

	
		var checkboxSel = new Ext.grid.CheckboxSelectionModel();
		
		
		   
	   var listGrid = new Ext.grid.GridPanel({
		   id:'unSubmitGrid',
		   region : 'center',
		   minColumnWidth : 35,
		   loadMask : {msg:'正在加载数据，请稍侯...'},
		    tbar:[{
	   						text:"提交退税",
								handler:function(){
												var datas =  listGrid.getSelectionModel().getSelections();
									if (datas.length == 0) {
										Ext.Msg.alert('提示', '请选择需要提交的信息!');
									} else {
										Ext.MessageBox.confirm('确认提交', '你确认要提交退税吗？', function(btn) {
											if (btn == "yes") {
												var jsonData = ""; 
												for ( var i = 0, len = datas.length; i < len;i++) {
													var mId = datas[i].get("UnSubmitId");
													if (i == 0) {
														jsonData = mId;
													} else {
														jsonData = jsonData + "," + mId;
													}
												}
												progressConsole();
												  var code,reason;
												
												  Ext.Msg.prompt('提交退税(如接单号已存在则增至其默认列表，否则创建新单)', '请输入接单号:', function(btn, text){
  													if (btn == 'ok'){
	  														code = text;
	  														Ext.Msg.prompt('提交退税', '请输入未提交原因:', function(btn, text){
	  															if (btn == 'ok'){
	  															reason = text;
	  													    Ext.Ajax.request( {
	  															url : '/weihe/addItems_unDb',
	  															success : function(response) {
	  															var json = Ext.decode(response.responseText);
	  															if (json.success) {
	  																if (json.deny) {
																		Ext.Msg.alert('消息', json.msg);
																	}else{
	  																Ext.Msg.alert('消息', json.msg, function() {
	  																	Ext.getCmp("unSubmitGrid").getStore().load({params : {start : 0, limit : 5}});
	  																	Ext.getCmp("unSubmitItemGrid").getStore().removeAll();
	  																});
	  															  }
	  															}else{
																	Ext.Msg.alert('消息', json.msg);
																}
	  														},
	  														failure : function() {
	  															Ext.Msg.alert('错误', '提交失败!');
	  														},
	  														params : {'datas' : jsonData,'unDb.reason':reason,'unDb.code':code}
	  								
	  													});

  													   }
  													});
  											}
  									});
												
												

										   }
										});
									}
								
								}
	   					},"-"],
		   store : unSubmitStore,
		   columns: [
		   			 checkboxSel,
		             {header : '序号', renderer:function(v,c,r,rowIndex){return r.store.lastOptions.params.start+rowIndex + 1;}},
		             {header : '核销单号', dataIndex : 'UnSubmitCheckCode'},
		             {header : '报关单号', dataIndex : 'UnSubmitCustomCode'},
		             {header : '出口日期', dataIndex : 'UnSubmitDate',sortable : true,renderer:Ext.util.Format.dateRenderer('Y年m月d日')},
		             {header : '申报日期', dataIndex : 'UnSubmitLastDate',sortable : true,renderer:Ext.util.Format.dateRenderer('Y年m月d日')},
		             {header : '录入单日期', dataIndex : 'UnSubmitReceiDate',sortable : true,renderer:Ext.util.Format.dateRenderer('Y年m月d日')},
		             {header : '币种', dataIndex : 'UnSubmitCurrency'},
		             {header : '出口金额', dataIndex : 'UnSubmitEsum'},
		             {header : '开票价合计', dataIndex : 'UnSubmitMoney'}
		             ],
         sm : checkboxSel,
         listeners :{ 
			   'rowclick':function(grid, rowIndex, event) {
			   		var record = grid.getStore().getAt(rowIndex);
			   		if(record.get('UnSubmitCheckCode') == '合计'){
			   			Ext.Msg.alert('提示','不能编辑合计项!');
			   			 listGrid.getSelectionModel().deselectRow(rowIndex);   
			   		}else{
				   	 	var datas = listGrid.getSelectionModel().getSelections();
				   	 	if(datas.length == 0){
				   	 	   Ext.getCmp("unSubmitItemGrid").getStore().removeAll();
				   	 	}else if(datas.length == 1){
				   			var record = datas[0];
					   		tmp = record.id;
					   		Ext.getCmp("unSubmitForm").form.loadRecord(record);
					   		Ext.getCmp("unSubmitItemForm").form.findField('unSubmit.id').setValue(record.id);
					   		Ext.getCmp("unSubmitItemForm").buttons[0].enable();
							Ext.getCmp("unSubmitItemForm").buttons[1].enable();
							Ext.getCmp("unSubmitItemForm").buttons[2].enable();
							Ext.getCmp("unSubmitForm").buttons[0].setText('修改');
							Ext.getCmp("unSubmitItemGrid").getStore().baseParams = {'unSubmit.id': record.id};
							Ext.getCmp("unSubmitItemGrid").getStore().load({params : {start : 0, limit : 5}});
				   		}else{
				   			var Datas="" ; 
				   			Ext.getCmp("unSubmitForm").form.reset();
				   			Ext.getCmp("unSubmitForm").buttons[0].disable();
							Ext.getCmp("unSubmitForm").buttons[1].disable();
							Ext.getCmp("unSubmitForm").buttons[2].disable();
							for ( var i = 0, len = datas.length; i < len;i++) {
									var mId = datas[i].get("UnSubmitId");
								if(i == 0){
										Datas = mId;
								}else{
									Datas = Datas + "," + mId;
								}
							}
							Ext.getCmp("unSubmitItemGrid").getStore().baseParams = {'datas': Datas};
						    Ext.getCmp("unSubmitItemGrid").getStore().load({params : {start : 0, limit : 5}});
					   		Ext.getCmp("unSubmitItemForm").buttons[0].disable();
							Ext.getCmp("unSubmitItemForm").buttons[1].disable();
							Ext.getCmp("unSubmitItemForm").buttons[2].disable();
			   			}
		   			}
			   	}
		   },
		  bbar : pageToolBar
});
		return listGrid;
	},
  
    grid : function(){
	 


		var pageToolBar = new Ext.PagingToolbar({
			pageSize : 6,
			store : taxItemStore,
			displayInfo : true,
			displayMsg : '当前显示{0}-{1}条记录,共{2}条记录',
		    emptyMsg : "没有记录显示!",
		    firstText : '首页',
		    prevText : '上一页',
		    nextText : '下一页',
		    lastText : '尾页',
		    beforePageText : '第',
		    afterPageText : '页,共{0}页'
		   


		});


		var rowSelectionModel = new Ext.grid.RowSelectionModel({singleSelect : true});
		
		   
	   var grid = new Ext.grid.GridPanel({
		   id:'unSubmitItemGrid',
		   title : '货物信息表',
		   region : 'center',
		   minColumnWidth : 50,
		   loadMask : {msg:'正在加载数据，请稍侯...'}, // 单击分页时显示,为true显示'Loading...'
		   store : taxItemStore,
		   columns: [
		             {header : '通知日期', dataIndex : 'TaxNoticeDate',sortable : true,renderer:Ext.util.Format.dateRenderer('Y-m-d')},
		             {header : '货物名称', dataIndex : 'TaxName'},
		             {header : '商品编码', dataIndex : 'TaxCode'},
		             {header : '承诺日期', dataIndex : 'TaxPromiseDate',sortable : true,renderer:Ext.util.Format.dateRenderer('Y-m-d')},
		             {header : '实际日期', dataIndex : 'TaxActualDate',sortable : true,renderer:Ext.util.Format.dateRenderer('Y-m-d')},
		             {header : '开票价', dataIndex : 'TaxMoney'},
		             {header : '退税率(%)', dataIndex : 'TaxTaxRate'},
		             {header : '退税金额', dataIndex : 'TaxTax'},
		             {header : '未提交原因', dataIndex : 'TaxReason'}
        ],
           sm : rowSelectionModel,
           listeners :{ 
			   'rowclick':function(grid, rowIndex, event) {
			   var record = grid.getStore().getAt(rowIndex);
			   if(record.get('TaxName')=='合计'){
			       Ext.Msg.alert('提示','不能编辑合计项!');
			   }else{
				   Ext.getCmp("unSubmitItemForm").form.loadRecord(record);
				   Ext.getCmp("unSubmitItemForm").buttons[0].setText('修改');
			   }
			  
		   }
		},
		  viewConfig : {
		     forceFit : false
		  },
		  bbar : pageToolBar
});
		return grid;
	},
	
	
	
	
	EIGrid : function(){
		 


		var pageToolBar = new Ext.PagingToolbar({
			pageSize : 6,
			store : EIStore,
			displayInfo : true,
			displayMsg : '当前显示{0}-{1}条记录,共{2}条记录',
		    emptyMsg : "没有记录显示!",
		    firstText : '首页',
		    prevText : '上一页',
		    nextText : '下一页',
		    lastText : '尾页',
		    beforePageText : '第',
		    afterPageText : '页,共{0}页'
		   


		});


		var rowSelectionModel = new Ext.grid.RowSelectionModel({singleSelect : true});
		
		   
	   var eiGrid = new Ext.grid.GridPanel({
		   id:'eiGrid',
		   title : '现存发票表',
		   border:'true',
		   region : 'west',
		   width : 380,
		   collapseMode :'mini',
		   collapsible : true,
		   split : true,
		   minColumnWidth : 50,
		   loadMask : {msg:'正在加载数据，请稍侯...'}, // 单击分页时显示,为true显示'Loading...'
		   store : EIStore,
		   columns: [
		             {header : '发票号', dataIndex : 'ExistentInvoiceInvoiceNum'},
		             {header : '单位名称', dataIndex : 'ExistentInvoiceCompany'},
		             {header : '商品名称', dataIndex : 'ExistentInvoiceName'},
		             {header : '开票日期', dataIndex : 'ExistentInvoiceDate', sortable : true,renderer:Ext.util.Format.dateRenderer('Y-m-d')},
		             {header : '数量', dataIndex : 'ExistentInvoiceCount'},
		             {header : '货价', dataIndex : 'ExistentInvoiceMoney'},
		             {header : '税额', dataIndex : 'ExistentInvoiceTax'},
		             {header : '退税率(%)', dataIndex : 'ExistentInvoiceTaxRate'}
		             ],
	       sm : rowSelectionModel,
	       listeners :{ 
			   'rowclick':function(grid, rowIndex, event) {
			   var record = grid.getStore().getAt(rowIndex);
			   	 if(record.get('ExistentInvoiceCompany') == '合计'){
			   	 	Ext.Msg.alert('提示','不能添加合计项!');
			   	 }else{
				     Ext.getCmp("unSubmitItemForm").form.findField('TaxName').setValue(record.get('ExistentInvoiceName'));
				     Ext.getCmp("unSubmitItemForm").form.findField('TaxMoney').setValue(record.get('ExistentInvoiceMoney'));
				     Ext.getCmp("unSubmitItemForm").form.findField('TaxTax').setValue(record.get('ExistentInvoiceTax'));
				     Ext.getCmp("unSubmitItemForm").form.findField('TaxTaxRate').setValue(record.get('ExistentInvoiceTaxRate'));
				     Ext.getCmp("unSubmitItemForm").form.findField('TaxId').setValue(record.get('ExistentInvoiceId'));
			   	 }
		   }
		},
		  viewConfig : {
		     forceFit : false
		  },
		  bbar : pageToolBar
	});
		return eiGrid;
		},
	
	unSubmitsForm : function(){
		
		

		var button_add = new Ext.Button({
			text : '添加',
			disabled : true,
			handler : function() {

					progressConsole();
				if(unSubmitsForm.form.isValid()){ 	
					if (unSubmitsForm.form.findField("existentInvoice.flag").getValue() == "") {
						unSubmitsForm.form.submit({
						  url : '/weihe/addItem_unSubmit',
						   success : function(form, action) {
							 if (action.result.deny) {
									 Ext.Msg.alert('错误', action.result.msg);
								  }else{
								Ext.Msg.alert('消息', action.result.msg, function() {
									 var i = unSubmitsForm.form.findField('unSubmit.id').getValue();
									   unSubmitsForm.form.reset();
									   unSubmitsForm.form.findField('unSubmit.id').setValue(i);
									   Ext.getCmp("unSubmitItemGrid").getStore().baseParams = {'unSubmit.id': i};
									   Ext.getCmp("unSubmitItemGrid").getStore().load({params : {start : 0, limit : 6}});
									   Ext.getCmp("unSubmitGrid").getStore().reload();
									   Ext.getCmp("eiGrid").getStore().reload();
//									   
									
								})
							  }
						    },
						    failure : function(form, action) {
      							Ext.Msg.alert('错误', action.result.msg);
      						}
					    })
					}else {
						unSubmitsForm.form.submit({
							  url : '/weihe/updateItem_unSubmit',
							   success : function(form, action) {
								if (action.result.deny) {
									 Ext.Msg.alert('错误', action.result.msg);
								  }else{
									Ext.Msg.alert('消息', action.result.msg, function() {
										var i = unSubmitsForm.form.findField('unSubmit.id').getValue();
										unSubmitsForm.form.reset();
										 unSubmitsForm.form.findField('unSubmit.id').setValue(i);
										 Ext.getCmp("unSubmitGrid").getStore().reload();
										 Ext.getCmp("unSubmitItemGrid").getStore().reload();
										 unSubmitsForm.buttons[0].setText('添加');
										
									})
								  }
							    },
							    failure : function(form, action) {
	      							Ext.Msg.alert('错误', action.result.msg);
	      						}
						    })

				
						
					}
			}else{
				Ext.Msg.alert('提示','请输入相关内容');
			}
				}
		
			
		});

	var button_clear = new Ext.Button({
		text : '清空',
		disabled : true,
		handler : function() {
		var i = unSubmitsForm.form.findField('unSubmit.id').getValue();
			unSubmitsForm.form.reset();
			unSubmitsForm.form.findField('unSubmit.id').setValue(i);
		    unSubmitsForm.buttons[0].setText('添加');
		}
	});

	var button_del = new Ext.Button({
		text : '删除',
		disabled : true,
		handler : function() {
			var id = unSubmitsForm.form.findField('TaxId').getValue();
			if (id == '') {
				Ext.Msg.alert('提示', '请选择需要删除的信息!');
			} else {
				progressConsole();
				Ext.Ajax.request({
					url : '/weihe/deleteItem_unSubmit',
					success : function(response) {
						var json = Ext.decode(response.responseText);
						if (json.success) {
							if (json.deny) {
											Ext.Msg.alert('消息', json.msg);
							}else{
								Ext.Msg.alert('消息', json.msg, function() {
									Ext.getCmp("unSubmitGrid").getStore().load({params : {start : 0, limit :6}});
									var i = unSubmitsForm.form.findField('unSubmit.id').getValue();
									unSubmitsForm.form.reset();
									unSubmitsForm.form.findField('unSubmit.id').setValue(i);
									unSubmitsForm.buttons[0].setText('添加');
									Ext.getCmp("unSubmitGrid").getStore().reload();
									Ext.getCmp("eiGrid").getStore().reload();
									Ext.getCmp("unSubmitItemGrid").getStore().reload();
							});
						  }
						}else{
							Ext.Msg.alert('消息', json.msg);
						}
					},
					failure : function() {
						Ext.Msg.alert('错误', '删除失败!');
					},
					params: { 'existentInvoice.id': id , 'unSubmit.id' : unSubmitsForm.form.findField('unSubmit.id').getValue() }

				});
			}
		}
	});
	
		var unSubmitsForm = new Ext.form.FormPanel({
			id : 'unSubmitItemForm',
			title : '货物信息',
			frame : true,
			width : 310,
			region : 'east',
			autoScroll : true,
			collapseMode :'mini',
			collapsible : true,
			labelAlign : 'right',
			labelWidth : 70,
			defaultType : 'textfield',
				defaults : {
				width : 200
			},
			items : [{
				id: 'TaxId',
				xtype : 'hidden',
				name : 'existentInvoice.id'
			},{
				xtype : 'hidden',
				name : 'unSubmit.id'
			},{
				id: 'TaxFlag',
				xtype : 'hidden',
				name : 'existentInvoice.flag'
			},{
				id: 'TaxNoticeDate',
                xtype: 'datefield',
                fieldLabel: "通知日期",
                format : 'Y-m-d',
    			allowBlank:false,
                name: "existentInvoice.noticeDate"
			},{
				id:'TaxName',
				fieldLabel : '货品名称',
				name : 'existentInvoice.name'
			},{
				id:'TaxCode',
				fieldLabel : '商品编码',
				name : 'existentInvoice.code'
			},{
				id: 'TaxPromiseDate',
                xtype: 'datefield',
                fieldLabel: "承诺日期",
                format : 'Y-m-d',
    			allowBlank:false,
                name: "existentInvoice.promiseDate"
			},{
				id: 'TaxActualDate',
                xtype: 'datefield',
                fieldLabel: "实际日期",
                format : 'Y-m-d',
    			allowBlank:false,
                name: "existentInvoice.actualDate"
			},{
				id:'TaxMoney',
				fieldLabel : '开票价',
				name : 'existentInvoice.money'
			},{
				id:'TaxTaxRate',
				fieldLabel : '退税率(%)',
				name : 'existentInvoice.taxRate'
			},{
				id:'TaxTax',
				fieldLabel : '退税金额',
				name : 'existentInvoice.tax'
			},{
				id:'TaxReason',
				fieldLabel : '未提交原因',
				name : 'existentInvoice.reason',
				value: '发票未回'
			}],
			buttons : [button_add,button_clear,button_del]
		
	});
		return unSubmitsForm;
	}
  }
}();








